#include "processbar.h"

const char* lable = "|/-\\";
void processbar()
{
  char bar[NUM];
  int cnt=0;
  memset(bar,'\0',sizeof(bar));
  int len=strlen(lable);
  bar[cnt]=HEAD;
  while(cnt<=100)
  {
    printf("[%-100s][%d%%][%c]\r",bar,cnt,lable[cnt%len]);
    fflush(stdout);
    bar[cnt++]=BODY;
    if(cnt<100)
    {
      bar[cnt]=HEAD;
    }
    usleep(100000);
  }
  printf("\n");
}
